<!--
 * @Descripttion: 评价信息
 * @version:
 * @Author: lehaixia
 * @Date: 2022-02-18 13:35:40
 * @LastEditors: lehaixia
 * @LastEditTime: 2022-02-25 10:20:43
-->
<template>
  <div v-loading="loading" class="remarkDetail">
    <ContentWrap>
      <div class="remarkTitle"> <span class="title">订单评价</span> </div>
      <table-box
        ref="refOrderTable"
        :table-height="400"
        show-index
        :table-config="orderTableConfig"
        @data-change="dataChange"
      />
    </ContentWrap>
  </div>
</template>

<script>
import ContentWrap from '@/components/ContentWrap'
import { parseTime } from '@/utils'
export default {
  components: {
    ContentWrap
  },
  props: {
    pcode: {
      type: String,
      default: ''
    },
    platformCode: {
      type: String,
      default: ''
    }
  },
  data() {
    const { sourceSystem } = this.$route.query
    let interfacePath = ''
    if (Number(sourceSystem) === 1) { // ECO
      interfacePath = `/call-center/api/v1/mscInfo/b2c/order/appraise?sourceSystem=${sourceSystem}&pcode=${this.pcode}&platformCode=${this.platformCode}`
    } else { // b2c
      interfacePath = `/call-center/api/v1/mscInfo/b2c/order/appraise?sourceSystem=${sourceSystem}&pcode=${this.pcode}`
    }

    return {
      loading: true,
      orderTableConfig: {
        interfacePath: interfacePath,
        hideFuncBar: true,
        tabIndex: 23,
        pageSize: 20,
        sort: 'created', // 开单时间
        order: 'desc',
        setting: [
          {
            prop: 'tid',
            label: '订单号',
            minWidth: 150
          },
          {
            prop: 'role',
            label: '评价者角色',
            minWidth: 120
          },
          {
            prop: 'result',
            label: '评价结果',
            minWidth: 150
          },
          {
            prop: 'created',
            label: '评价创建时间',
            minWidth: 150,
            formatData: ({ created }) => {
              return parseTime(created)
            }
          },
          {
            prop: 'itemTitle',
            label: '商品标题',
            minWidth: 200
          },
          {
            prop: 'itemPrice',
            label: '商品价格',
            minWidth: 120
          },
          {
            prop: 'content',
            label: '评价内容',
            minWidth: 150
          },
          {
            prop: 'reply',
            label: '评价解释',
            width: 100
          },
          {
            prop: 'validScore',
            label: '评价信息是否用于计分',
            minWidth: 200,
            formatData: ({ validScore }) => {
              return validScore ? '是' : '否'
            }
          }
        ]
      }
    }
  },
  created() {

  },
  methods: {
    dataChange(res) {
      const { success } = res
      if (success === 1) {
        this.loading = false
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.remarkDetail {
  .remarkTitle {
    margin-top: 15px;
    padding-bottom: 5px;
    .title {
      font-size: 14px;
      font-weight: 700;
      // color: #16BC83;
      color: #444444;
    }
  }
}
</style>
